#ifndef  __MILFS_OBJECT_HEADER__
#include <milfs_keyvalue.h>
#include <stdint.h>
#include <time.h>

/*
typedef struct {
  uint8_t   type;
  uint32_t  ref_count;
  time_t    life_span;
  time_t    age;
  uint32_t  addr_size;
  uint32_t  data_size;
  char	    *addr;
  char	    *data;
} mlf_object;

void mlf_object_to_keyvalue(mlf_object *object, mlf_key_value *kv);

void mlf_object_from_keyvalue(mlf_key_value *kv, mlf_object *object);

void mlf_object_age(mlf_object *object, time_t *max_age);
*/


typedef struct ___mlk_kv_list {
  struct ___mlf_kv_list *next;
  mlf_key_value *entry;
} __mlf_kv_list;


typedef struct {
  uint8_t	    type;
  __mlf_kv_list	    *attributes;
} mlf_object;

mlf_object *mlf_object_new(uint8_t type);

void mlf_object_push(mlf_object *object, char *key, char *value, int vsize);

char *mlf_object_pop(mlf_object *object, char *key, int *vsize);

char *mlf_object_serialize(mlf_object *object);

mlf_object *mlf_object_deserialize(char *stream, int size);

#endif
